import Rules from './Rules';

const { COMMON_RULE, LENGTH_RULE, FLOAT_NUMBER_RULE } = Rules;
const NUMBER_COMMON_RULE = COMMON_RULE({ type: 'number' });

export const videoRule = {
  // 视频名称
  title: COMMON_RULE().concat(LENGTH_RULE(1, 20)),
  // 封面
  cover: COMMON_RULE(),
  // 简介
  summary: COMMON_RULE().concat(LENGTH_RULE(1, 30)),
  // 课程介绍
  intro: COMMON_RULE(),
  // 分类
  categoryId: NUMBER_COMMON_RULE,
  // 评分
  score: NUMBER_COMMON_RULE.concat(FLOAT_NUMBER_RULE(1)),
  // 等级
  level: NUMBER_COMMON_RULE,
  // 讲师
  uuids: COMMON_RULE(),
  showVideoId: COMMON_RULE({ message: '请先上传视频' }),
};

export const singleVideoRule = {
  ...videoRule,
  payMode: NUMBER_COMMON_RULE,
  payPrice: NUMBER_COMMON_RULE.concat(FLOAT_NUMBER_RULE(2)),
  showPrice: NUMBER_COMMON_RULE.concat(FLOAT_NUMBER_RULE(2)),
};
